cmake_minimum_required(VERSION 3.1)

# 源码以 UTF-8 编码保存，使用 MSVC 编译器需要加编译参数提供支持
if(MSVC)
    add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
    add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
    message(STATUS "optional: /UTF-8")   
endif(MSVC)

macro(api_exe target)
    add_executable(${target} ${target}.cpp)
    target_link_libraries(${target} mirai-cpp)
    # gcc 要连接 pthread
    if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
    target_link_libraries(${target} pthread)
    endif()
endmacro()

api_exe(RepeatMessage)
api_exe(SendImageMessage)
api_exe(GetFriendList)
api_exe(GetGroupList)
api_exe(Mute)
api_exe(Recall)
api_exe(RichMessage)
api_exe(NewFriendEvent)
api_exe(MemberJoinEvent)
api_exe(BotEvents)
api_exe(MemberLeaveEvent)
api_exe(RecallEvent)
api_exe(MessageType)
api_exe(FetchEventsViaHTTP)
api_exe(GroupMemberInfo)
api_exe(GroupNameChange)
api_exe(GroupConfig)
api_exe(MemberCardChange)
api_exe(Command)
api_exe(VoiceMessage)
api_exe(NudgeEvent)
api_exe(FileMessage)